#include "nest.h"
#include <QDebug>

Nest::Nest(int r, int a, int id, QColor bcol, QColor lcol, QWidget *parent) :
    QLabel(parent)
{
    this->r = r;
    this->a = a;
    this->id = id;
    this->bcol = bcol;
    this->lcol = lcol;


    empty = true;
    bob =0;
}

void Nest::resizeEvent(QResizeEvent *e) {
    QSize sz = e->size();
    if (sz.isEmpty()) return;

    QPixmap pxm(sz);
    pxm.fill(QColor(0,0,0,0));

    QPainter pnt(&pxm);
    int rad = 0.5*qMin(pxm.width(),pxm.height())/2;
    pnt.setBrush(QBrush(lcol));
//    pnt.setPen(QPen(QBrush(lcol),3,Qt::SolidLine,Qt::FlatCap,Qt::RoundJoin));
    pnt.drawEllipse(pxm.rect().center(), rad, rad);
//    pnt.drawRoundedRect(pxm.rect().adjusted(5,5,-5,-5), rad, rad);
    pnt.end();


    setPixmap(pxm);
//    setText(QString::number(id));

}


void Nest::mousePressEvent(QMouseEvent *ev) {
//    qDebug() << this << "picked";
    if (empty) emit come_here(this);
}

QSize Nest::sz = QSize();
